<template>
  <div class="dashboard-container">
    <component :is="currentRole"/>
  </div>

</template>

<script>
import { mapGetters } from 'vuex'
import OrderProduct from './components/orderProduct'
import OrderSchedule from './components/orderSchedule'

export default {
  name: 'OrderList',
  components: { OrderProduct, OrderSchedule },
  computed: {
    ...mapGetters([
      'roles'
    ])
  },
  data() {
    return {
      currentRole: ''
    }
  },
  created() {
    this.roles.forEach(res => {
      if (res === 'merchant') {
        this.currentRole = 'OrderProduct'
      }
      if (res === 'merchant-schedule') {
        this.currentRole = 'OrderSchedule'
      }
    })
  }
}

</script>

<style scoped>

</style>
